#include "defines.h"

void sendchar(char c)
{
#ifdef _ATMEGA16
   UDR=c;
   while (!(UCSRA & (1<<TXC)));                      //wait until byte sendt
   UCSRA |= (1<<TXC);                             //delete TXCflag
#endif
#ifdef _ATMEGA32
   UDR=c;
   while (!(UCSRA & (1<<TXC)));                      //wait until byte sendt
   UCSRA |= (1<<TXC);                             //delete TXCflag
#endif
#ifdef _ATMEGA161
   UDR0=c;
   while (!(UCSR0A & (1<<TXC0)));                      //wait until byte sendt
   UCSR0A |= (1<<TXC0);                             //delete TXCflag
#endif
#ifdef _ATMEGA163
   UDR=c;
   while (!(UCSRA & (1<<TXC)));                      //wait until byte sendt
   UCSRA |= (1<<TXC);                             //delete TXCflag
#endif
}

char recchar(void)
{
#ifdef _ATMEGA16
   while(!(UCSRA & (1<<RXC)));                       // Wait for data to come
   return UDR;
#endif
#ifdef _ATMEGA32
   while(!(UCSRA & (1<<RXC)));                       // Wait for data to come
   return UDR;
#endif
#ifdef _ATMEGA161
   while(!(UCSR0A & (1<<RXC0)));                       // Wait for data to come
   return UDR0;
#endif
#ifdef _ATMEGA163
   while(!(UCSRA & (1<<RXC)));                       // Wait for data to come
   return UDR;
#endif
}




